﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

namespace Zocono.WCS.Infrastructure.ApllicationDto.DtoWcsManage
{
    /// <summary>
    /// plc read 查询类
    /// </summary>
    public class QueryPlcReadDbInfoDto : PageResultDto
    {
        /// <summary>
        /// 任务关联id
        /// </summary>
        public long? JobID { get; set; }
        /// <summary>
        /// plc连接关联Id
        /// </summary>
        public long? PlcConnectionID { get; set; }


        public string EquipmentCode { get; set; }
        /// <summary>
        /// db编号
        /// </summary>
        public int? DbCode { get; set; }
        /// <summary>
        /// 是否心跳
        /// </summary>
        public bool? IsHeartbeat { get; set; }
        /// <summary>
        /// 是否可用
        /// </summary>
        public bool? IsEnable { get; set; }
        /// <summary>
        /// 报文处理模块类型，用于工厂创建报文处理模块对象
        /// </summary>
        public string ProcessModuleType { get; set; }
        /// <summary>
        /// 报文处理模块对象的名称
        /// </summary>
        public string ProcessModuleName { get; set; }
        /// <summary>
        /// PLC名称其实由 jobname和plcconnectID确定一个
        /// </summary>
        public string PlcName { get; set; }
    }

    public class PlcReadDbInfoDto
    {
        public long ID { get; set; }
        public string Js_Id { get { return ID.ToString(); } }
        /// <summary>
        /// 任务关联id
        /// </summary>
        public long JobID { get; set; }
        /// <summary>
        /// plc连接关联Id
        /// </summary>
        public long PlcConnectionID { get; set; }

        public string EquipmentCode { get; set; }
        /// <summary>
        /// db编号
        /// </summary>
        public int DbCode { get; set; }
        /// <summary>
        /// db读取起始位
        /// </summary>
        public int DbStart { get; set; }
        /// <summary>
        /// db读取长度往后可修改成Float
        /// </summary>
        public int DbLength { get; set; }
        /// <summary>
        /// 是否心跳
        /// </summary>
        public bool IsHeartbeat { get; set; }
        /// <summary>
        /// 是否可用
        /// </summary>
        public bool IsEnable { get; set; }
        /// <summary>
        /// 报文处理模块类型，用于工厂创建报文处理模块对象
        /// </summary>
        public string ProcessModuleType { get; set; }
        /// <summary>
        /// 报文处理模块对象的名称
        /// </summary>
        public string ProcessModuleName { get; set; }
        /// <summary>
        /// PLC名称其实由 jobname和plcconnectID确定一个
        /// </summary>
        public string PlcName { get; set; }
        /// <summary>
        /// 任务名称
        /// </summary>
        [Required(AllowEmptyStrings = true)]
        public string JobName { get; set; }
        /// <summary>
        /// 进程编号
        /// </summary>
        [Required(AllowEmptyStrings = true)]
        public string ProgrameCode { get; set; }
        /// <summary>
        /// plc ip
        /// </summary>
        [Required(AllowEmptyStrings = true)]
        public string PlcConnectionIP { get; set; }
        /// <summary>
        /// plc cpu
        /// </summary>
        [Required(AllowEmptyStrings = true)]
        public string PlcCpuType { get; set; }

        [Required(AllowEmptyStrings = true)]
        public string PlcCpuTypeName { get; set;}
    }
}
